<?php
declare(strict_types=1);

namespace App\Console\Commands\Tasks;

use App\Repositories\Streamer\StreamerApplyRepository;
use App\Repositories\Streamer\StreamerTaskRecordRepository;
use Illuminate\Console\Command;

class StreamerTaskCommand extends Command
{
    //命令名
    protected $signature = 'task:streamer_task';

    //命令描述
    protected $description = 'streamer task';

    public function getSignature()
    {
        return $this->signature;
    }

    public function __construct()
    {
        parent::__construct();
    }

    //业务处理
    public function handle()
    {

        $userIds =  StreamerApplyRepository::getInstance()->streamers();
        if($userIds->isNotEmpty()){
            StreamerTaskRecordRepository::getInstance()->generateDay($userIds->toArray());
            StreamerTaskRecordRepository::getInstance()->generateWeek($userIds->toArray());
        }
    }

}